 <script th:inline="javascript">
/*<![CDATA[*/

    function del(event,element){
        event.preventDefault();
          bootbox.confirm("您确定删除吗?", function(result) {
        if(result){
            var _id = $(element).attr("href").split("_")[0];
            var _page=$(element).attr("href").split("_")[1];
            var _viewState = $(element).attr("href").split('_')[2];
            var _couponPromotioinId = $("#hidden_couponPromotionId").val();

            BOSS.remoteCall('promotion/coupon/deleteCoupon',$('#coupon_grid'),{id:_id,couponPromotionId:_couponPromotioinId,page:_page,viewState:_viewState});
            }
        }); 
    }
    
/*]]>*/
</script>
<input id="hidden_couponPromotionId" type="hidden" th:value="${couponPromotionId}"/>
<table layout:fragment="coupon_table" class="table table-striped table-bordered  table-advance table-hover" id="coupon_grid">
    <thead>
        <tr>
            <th>发放类型</th>
            <th>序列号</th>
            <th>使用订单</th>
            <th>使用用户</th>
            <th>使用时间</th>
            <th>操作</th>
        </tr>
    </thead>    
    <tbody>
        <tr class="odd gradeX" th:each="data : ${couponPage}">
            <td th:text="${data.bonusPromotion.grantType.description}">
                发放类型
            </td>
            <td th:text="${data.code}">
                 序列号
            </td>
            <td th:text="${data.orderId}">
                使用订单
            </td>
            <td th:text="${data.user} ? ${data.user.name} : '未绑定用户'">
            </td>
            <td th:text="${data.usedDate} != null ? ${#calendars.format(data.usedDate,'yyyy-MM-dd HH:mm:ss')} : '未使用'">
                未使用
            </td>
            <td>
                <a th:attr="id=${'link_delete_'+dataStat.index}" th:href="${data.id}+'_'+${couponPage.number}+'_'+${viewState}" onclick="del(event,this)">移除</a>
            </td>         
        </tr>
     </tbody>
</table>

